/*-------------------------------------
		sPlugin
	    By Scooby, 2010
-------------------------------------*/

local PLUGIN = {}

PLUGIN.Name = "Noclip"
PLUGIN.Author = "Scooby"
PLUGIN.Command = "noclip"
PLUGIN.Group = 2
PLUGIN.Category = "Fun"
PLUGIN.Format = "string"
PLUGIN.Use = "<Player>"
PLUGIN.Menu = {
	{
		title = "Choose Player",
		cont = "#players",
		apos = 1
	}
}


function PLUGIN:Main( ply, args )
	
	local pl = spl:FindPly( args[1] or ply:Nick() )
	
	if( #pl == 0 ) then
		spl:PrintC( ply, spl.red, spl.fnp )
		return false
	elseif( #pl > 1 ) then
		spl:PrintC( ply, spl.red, spl.fmp )
		return false
	end
	
	local old = pl[1]:GetMoveType()

	if( old != MOVETYPE_NOCLIP ) then
		pl[1]:SetMoveType( MOVETYPE_NOCLIP ) 
	else
		pl[1]:SetMoveType( MOVETYPE_WALK )
	end
	
	spl:PrintC( spl.blue, ply:Nick(), spl.white, " Toggled NoClip On ", spl.green, pl[1]:Nick() )
	
end

spl:AddPlugin( PLUGIN )